import React from 'react';
import Layout from '../../components/Layout';
import { RouteConfig } from './remaining';

// 懒加载 IoT 组件
const IoTDashboard = React.lazy(() => import('../../views/IoT'));
const DeviceManagement = React.lazy(() => import('../../views/IoT/Device'));
const ProductManagement = React.lazy(() => import('../../views/IoT/Product'));

const iotRoutes: RouteConfig[] = [
  {
    path: '/iot',
    element: <Layout />,
    children: [
      {
        path: '',
        element: <IoTDashboard />,
        meta: {
          title: 'IoT 概览',
          icon: 'cloud',
          noCache: false
        }
      },
      {
        path: 'device',
        element: <DeviceManagement />,
        meta: {
          title: '设备管理',
          icon: 'mobile',
          noCache: false
        }
      },
      {
        path: 'product',
        element: <ProductManagement />,
        meta: {
          title: '产品管理',
          icon: 'appstore',
          noCache: false
        }
      }
    ],
    meta: {
      title: 'IoT 管理',
      icon: 'cloud'
    }
  }
];

export default iotRoutes;